#! /bin/bash
#useradd
#v1.0 by wangtao 2019/01/12
read -p "请输入数字: " num
if [[ ! "$num" =~ ^[0-9]+$ ]];then
	echo "error number"
	exit
fi

read -p "请输入前缀: " prefix
if [ -z "$prefix" ];then
	echo "error prefix"
	exit
fi
for i in `seq $num`
do
	user=$prefix$i
	useradd $user
	echo "123"|passwd --stdin $user &>/dev/null
	if [ $? -eq 0 ];then
		echo "$user is created..."
	fi
done
